﻿using AppServiceDtoToEntityDemo.Application.Orders;
using AppServiceDtoToEntityDemo.Application.Orders.Assemblers;
using AppServiceDtoToEntityDemo.Application.Orders.Dtos;
using AppServiceDtoToEntityDemo.Domain.Orders;
using AppServiceDtoToEntityDemo.Infrastructure.Orders;
using Microsoft.Extensions.DependencyInjection;

var serviceCollection = new ServiceCollection();
serviceCollection.AddTransient<IOrderAppService, OrderAppService>();
serviceCollection.AddTransient<ICreateOrderDtoAssembler, CreateOrderDtoAssembler>();
serviceCollection.AddTransient<IOrderRepository, OrderRepository>();

var serviceProvider = serviceCollection.BuildServiceProvider();
var orderAppService = serviceProvider.GetRequiredService<IOrderAppService>();
var createOrderDto = PrepareParameter();
var count = orderAppService.Create(createOrderDto);
Console.WriteLine(count);
Console.ReadLine();

static CreateOrderDto PrepareParameter()
{
    return new CreateOrderDto()
    {
        CategoryId = 1,
        Name = "Order",
        Description1 = "Test",
        Description2 = "Test",
        Description3 = "Test",
        Description4 = "Test",
        Description5 = "Test",
        Description6 = "Test",
        Description7 = "Test",
        Description8 = "Test",
        Description9 = "Test",
        Description10 = "Test",
        Description11 = "Test",
        Description12 = "Test",
        Description13 = "Test",
        Description14 = "Test",
        Description15 = "Test",
        CreateOrderItems = new List<CreateOrderItemDto>()
    {
        new CreateOrderItemDto()
        {
            Amount = 1,
            ProductId =1,
            Description1 = "Test",
            Description2 = "Test",
            Description3 = "Test",
            Description4 = "Test",
            Description5 = "Test",
            Description6 = "Test",
            Description7 = "Test",
            Description8 = "Test",
            Description9 = "Test",
            Description10 = "Test",
            Description11 = "Test",
            Description12 = "Test",
            Description13 = "Test",
            Description14 = "Test",
            Description15 = "Test",
        },
        new CreateOrderItemDto()
        {
            Amount = 2,
            ProductId = 2,
            Description1 = "Test",
            Description2 = "Test",
            Description3 = "Test",
            Description4 = "Test",
            Description5 = "Test",
            Description6 = "Test",
            Description7 = "Test",
            Description8 = "Test",
            Description9 = "Test",
            Description10 = "Test",
            Description11 = "Test",
            Description12 = "Test",
            Description13 = "Test",
            Description14 = "Test",
            Description15 = "Test",
        },
        new CreateOrderItemDto()
        {
            Amount = 3,
            ProductId = 3,
            Description1 = "Test",
            Description2 = "Test",
            Description3 = "Test",
            Description4 = "Test",
            Description5 = "Test",
            Description6 = "Test",
            Description7 = "Test",
            Description8 = "Test",
            Description9 = "Test",
            Description10 = "Test",
            Description11 = "Test",
            Description12 = "Test",
            Description13 = "Test",
            Description14 = "Test",
            Description15 = "Test",
        },
        new CreateOrderItemDto()
        {
            Amount = 4,
            ProductId = 4,
            Description1 = "Test",
            Description2 = "Test",
            Description3 = "Test",
            Description4 = "Test",
            Description5 = "Test",
            Description6 = "Test",
            Description7 = "Test",
            Description8 = "Test",
            Description9 = "Test",
            Description10 = "Test",
            Description11 = "Test",
            Description12 = "Test",
            Description13 = "Test",
            Description14 = "Test",
            Description15 = "Test",
        },
        new CreateOrderItemDto()
        {
            Amount = 5,
            ProductId = 5,
            Description1 = "Test",
            Description2 = "Test",
            Description3 = "Test",
            Description4 = "Test",
            Description5 = "Test",
            Description6 = "Test",
            Description7 = "Test",
            Description8 = "Test",
            Description9 = "Test",
            Description10 = "Test",
            Description11 = "Test",
            Description12 = "Test",
            Description13 = "Test",
            Description14 = "Test",
            Description15 = "Test",
        },
    }
    };
}